package com.mychanggou.goods;

import entity.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/9/15 11:32 下午
 * @desc ：
 */
@SpringBootApplication
@EnableEurekaClient//开启Eureka客户端
@MapperScan(basePackages = "com.mychanggou.goods.dao")
public class GoodsApplication {
    @Value("${workerId}")
    private Integer workerId;
    @Value("${datacenterId}")
    private Integer datacenterId;

    public static void main(String[] args) {
        SpringApplication.run(GoodsApplication.class);
    }
    @Bean
    public IdWorker idWorker(){
        return new IdWorker(workerId,datacenterId);
    }
}
